<?php
//return [
//    'goodssss/:id' => ['index/Goods/updateGood' , ['method' => 'put'] , ['id' => '\d+']]
//];

//设置全局变量规则,全部路由有效
use think\Route;

//设置name变量规则(采用正则表达式)
//Route::pattern("name" , "\w+");
////支持批量添加
//Route::pattern([
//    'age' => "\d{1,2}",
//    "id" => "\d+"
//]);
//全局有效
//Route::get("news/:id/:age" , "index/News/read" , [] , ['age' => '\d{1,3}']);

//Route::get("goods/:id" , "index/Goods/goodFind" , [] , ['__url__' => 'goods\/\w+$']);

/*Route::get('goods--<id>-<name?>','index/Goods/goodFind',[],['id'=>'\d+' , 'name' => '\w+']);*/

    //检测路由的规则仅为GET的时候有效
//Route::any('news/:id' , 'index/News/read' , ['method' => 'get']);

//检测路由规则仅支持GET和POST请求有效
//Route::any("news/:id" , "index/News/read" , ['method' =>'get|post']);

//URL后缀
//Route::get("news/:id" , 'index/News/read' , ['ext' => 'html']);
//Route::get("news/:id" , "index/News/read" , ['ext' => 'shtml|html|pngs' , 'deny_ext' => 'jpg|png|gif']);

//域名检测
//Route::get("news/:id" , 'index/News/read' , ['domain' => 'lh.liuhousetp5fx.cc']);
    
    
//    Route::get("news/:id" , 'index/News/read' , ['domain' => '']);


//HTTPS检测
//Route::get("news/:id" , "index/News/read" , ['https' => false]);

//前置行为检测 和  后置行为检测  都没问题
//Route::get("news/:id" , 'index/News/read' , ['before_behavior' => '\app\index\behavior\UserCheck'
//,'after_behavior' => '\app\index\behavior\ReadInfo']);

// function my_check_fun(){
//     return true;
// }
 
//Callback检测
//Route::get("news/:id" , "index/News/read" , ["callback" => "my_check_fun"]);

//Route::get("news/:id" , 'index/News/read' ,['merge_extra_vars' => false]);

//在配置文件中添加路由参数
//return [
//    'news/:id' => ['index/News/read'  , ['method' => 'get' , 'ext' => 'html|shtml|""']]
//];


//Route::get("news/:id" , "index/News/read" , ['bind_model' => [
//    'user' => function(){
//        $data = ["id" => 1 , "name" => '1212'];
//        return $data;
//    }
//]]);



//Route::get("news/:id" , "index/News/read" , ['cache' => 1]);
    
    Route::get("hello/:name" , function ($name){
        return "Hello" . $name;
    });

return [
    //这样之所以能访问,是因为有设置默认模块  ， 但是为了便于理解,最好的方法 就是从模块开始编写
//    'blog/:id' => 'index/blog/read',
//    'admin_blog/:id' => 'admin/blog/read'
//    'user/:id' => 'index/group.user/read'
//    ":action/blog/:id" => 'index/blog/:action'
//    ':c/:a/:id' => 'admin/:c/:a'
//    'blog/:id' => 'index/blog/read?status=1&app_id=5'

//'blog/:id' => '@index/blog/readone'
//   也就是不是控制器也能使用 ， 也就是说控制器不一定要写在controller下面,根据路由,可以自定义
//但是如果使用的是pathinfo形式的话，就一定要按照controller的方式进行访问 ， 因为这是人家规定好的
//动态方法调用使用@
//    'blog/:id' => '\app\index\service\Blog@read',
    //调用静态方法使用 ::
    //静态方法是进行调用的
//    'blogst/:id' => '\app\index\service\Blog::readMe'

//'blogst/:id' => '\app\index\service\Blog::readMe?status=1111'

//外部地址
//'blogst/:id' => '/blog/:id'

//'blogst/:id' => 'https://www.xiaobangcai.com'

//'blog/:id' => 'http://blog.thinkphp.cn/read/:id'






];













